﻿using CPPEI.ETL.WebApi.DataContracts.Create;
using CPPEI.WebApi;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;

namespace CPPEI.ETL.WebApi
{
    public class CreateController : ApiController
    {
        [HttpPost]
        public ServiceResult Task(CreateTaskParams @params)
        {
            return new Domain.Services.TaskService().CreateTask(Intergration.Config.AuthProvider.GetUserId(), @params.Name,
                @params.DataServiceId,
                @params.DataSourceId,
                @params.CategoryId,
                @params.RunMode,
                @params.EnableCodeConversion,
                @params.EnableDataVerification,
                @params.CompleteEvent,
                @params.RunModeSettings,
                @params.ParameterNames,
                @params.ParameterTypes,
                @params.ParameterValues);
        }

        [HttpPost]
        public ServiceResult TaskCategory(TaskCategoryParams @params)
        {
            return new Domain.Services.CreateService().CreateTaskCategory(@params.ParentId, @params.Code, @params.Name);
        }
    }
}
